package cn.iocoder.yudao.module.english.dal.mysql.questionbank;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.english.dal.dataobject.questionbank.QuestionBankDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.english.controller.admin.questionbank.vo.*;

/**
 * 题库 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface QuestionBankMapper extends BaseMapperX<QuestionBankDO> {

    default PageResult<QuestionBankDO> selectPage(QuestionBankPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<QuestionBankDO>()
                .eqIfPresent(QuestionBankDO::getLevelId, reqVO.getLevelId())
                .eqIfPresent(QuestionBankDO::getCourseId, reqVO.getCourseId())
                .eqIfPresent(QuestionBankDO::getQuestionType, reqVO.getQuestionType())
                .eqIfPresent(QuestionBankDO::getQuestionDescription, reqVO.getQuestionDescription())
                .eqIfPresent(QuestionBankDO::getAnswerJson, reqVO.getAnswerJson())
                .eqIfPresent(QuestionBankDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(QuestionBankDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(QuestionBankDO::getId));
    }

}